#include <bits/stdc++.h>
// 2024/07/27
const int SIZE = 2;
using namespace std;

signed main()
{
    ifstream f("W.txt");
    vector<double> W(SIZE + 1);
    for (int i = 0; i <= SIZE; ++i)
        f >> W[i];
    while (true)
    {
        vector<double> Input(SIZE);
        for (int i = 0; i < SIZE; ++i)
            cin >> Input[i];
        Input[0] *= Input[0];
        double result = W[SIZE];
        for (int i = 0; i < SIZE; ++i)
            result += Input[i] * W[i];
        cout << "Result: " << result << endl;
    }
    return 0;
}